# Contributor: Fabian Affolter <fabian@affolter-engineering.ch>
# Maintainer: Fabian Affolter <fabian@affolter-engineering.ch>
pkgname=py3-wbdata
_pkgname=wbdata
pkgver=1.0.0
pkgrel=1
pkgdesc="A library to access World Bank data"
options="!check" # Tests are broken
url="https://github.com/oliversherouse/wbdata"
arch="noarch"
license="GPL-2.0-or-later"
depends="python3 py3-decorator"
makedepends="py3-poetry-core py3-gpep517"
subpackages="$pkgname-pyc"
source="https://files.pythonhosted.org/packages/source/${_pkgname:0:1}/$_pkgname/$_pkgname-$pkgver.tar.gz"
builddir="$srcdir/$_pkgname-$pkgver"

replaces="py-wbdata" # Backwards compatibility
provides="py-wbdata=$pkgver-r$pkgrel" # Backwards compatibility

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	gpep517 install-wheel --destdir .testenv --prefix '' .dist/*.whl
	.testenv/bin/python3 -m unittest
}

package() {
	gpep517 install-wheel --destdir "$pkgdir" \
		.dist/*.whl
}

sha512sums="
649d994d4d42e4cadc532212f799a4788317e58bd2d6cfb971f7331622d9df0da04229221eff5cb1ca401b6d9289a8215e242be2f7dfd2607e7eb01cd6c3dbcf  wbdata-1.0.0.tar.gz
"
